package middleware

import (
	"gitee.com/song-yao-shun/MQH/response"
	"github.com/gin-gonic/gin"
	"log"
)

func RecoveryMiddleware() gin.HandlerFunc{
	return func(c *gin.Context) {
		defer func() {
			if err := recover(); err != nil {
				log.Println(err)
				response.Fail(c, nil, "程序出游了，程序员正在追捕！")
			}
		}()

		c.Next()
	}
}
